Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Disambiguate associated items in trait impls #193

Merged
merged 1 commit into from
Nov 19, 2021

Conversation

tylerwhall
Copy link
Contributor

@tylerwhall tylerwhall commented Nov 18, 2021

The addition of TryFrom<&str> for EnumString breaks for enums that have
a variant called "Error". Rewrite as <Self as Trait> where associated
types are used as the return type for trait functions.

Example:

#[derive(EnumString)]
pub enum Test {
    Error,
}

error: ambiguous associated item
--> src/lib.rs:3:10
|
3 | #[derive(EnumString)]
| ^^^^^^^^^^
|
= note: #[deny(ambiguous_associated_items)] on by default
= warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
= note: for more information, see issue #57644 rust-lang/rust#57644

@Peternator7
Copy link
Owner

Makes sense. If you can resolve the conflict, I can get this merged and put out a patch release.

The addition of TryFrom<&str> for EnumString breaks for enums that have
a variant called "Error". Rewrite as <Self as Trait> where associated
types are used as the return type for trait functions.

Example:

```rust
pub enum Test {
    Error,
}
```

error: ambiguous associated item
   --> src/lib.rs:3:10
    |
3   | #[derive(EnumString)]
    |          ^^^^^^^^^^
    |
    = note: `#[deny(ambiguous_associated_items)]` on by default
    = warning: this was previously accepted by the compiler but is being phased out; it will become a hard error in a future release!
    = note: for more information, see issue #57644 <rust-lang/rust#57644>
@Peternator7
Copy link
Owner

Just published a patch version of strum_macros to crates.io

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

EnumString Error "ambiguous_associated_items" (Issue #57644)
3 participants